package com.ccsu.mymarket.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ccsu.mymarket.dao.DeliveryAddressDao;
import com.ccsu.mymarket.entity.DeliveryAddress;
import com.ccsu.mymarket.service.DeliveryAddressService;
import com.ccsu.mymarket.service.RegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeliveryAddressServiceImpl extends ServiceImpl<DeliveryAddressDao, DeliveryAddress> implements DeliveryAddressService {

    private DeliveryAddressDao addressDao;
    private RegionService regionService;

    public DeliveryAddressServiceImpl(@Autowired DeliveryAddressDao addressDao, @Autowired RegionService regionService) {
        this.addressDao = addressDao;
        this.regionService = regionService;
    }

    @Override
    public List<DeliveryAddress> getAddressByUser(Integer id) {
        return addressDao.selectList(new LambdaQueryWrapper<DeliveryAddress>().eq(DeliveryAddress::getAccId,id));
    }
}
